package com.aaa.util;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置注解:表示当前类是一个配置类
@Configuration
public class UploadImgMapping implements WebMvcConfigurer{
	//重写文件资源映射方法
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		//网址url--->磁盘文件路径
		registry.addResourceHandler(UploadUtil.UPFILE_URL_DIR+"**")
			    .addResourceLocations("file:"+UploadUtil.DISK_UPLOAD_DIR);
	}
}
